import 'package:flutter/material.dart';
import 'package:music_pc/components/custom_tab_bar.dart';
import 'package:music_pc/pages/music/channel.dart';
import 'package:music_pc/pages/music/recommend.dart';
import 'package:music_pc/pages/music/singer.dart';
import 'package:music_pc/pages/music/song_list.dart';

class MusicPage extends StatefulWidget {
  const MusicPage({super.key});

  @override
  State<MusicPage> createState() => _MusicPageState();
}

class _MusicPageState extends State<MusicPage>
    with SingleTickerProviderStateMixin {
  late TabController _tabController;
  final tableList = ["推荐", "频道", "歌单", "歌手"];

  @override
  void initState() {
    super.initState();
    _tabController = TabController(
      length: tableList.length,
      vsync: this,
      animationDuration: Duration.zero,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisSize: MainAxisSize.max,
      children: [
        //顶部tabBar
        CustomTabBar(tabList: tableList, controller: _tabController),
        Expanded(
          child: TabBarView(
            controller: _tabController,
            children: [
              RecommendPage(),
              ChannelPage(),
              SongListPage(),
              SingerPage(),
            ],
          ),
        ),
      ],
    );
  }
}
